// window.parent.location.hash = '#c=60071010';

import React, {Component} from 'react';

import './index.less';

import {getMetaKey, high, toast} from 'nc-lightapp-front';
import mockFn from '../mock';

import SearchModal from '../components/SearchModal';
import OnlyInfoModal from '../components/OnlyInfoModal';
import SwitchToDocModal from '../components/SwitchToDocModal';
import JobHisModal from '../components/JobHisModal';
import ReptObjModal from '../components/ReptObjModal';
import CreateUserModal from '../components/CreateUserModal';
import FileManager from '../components/Uploader';
import ExportModal from '../components/ExportModal';
import SubSetTable from '../components/SubSetTableCard';
import ImportModal from '../components/ImportModal/index';
import WpsModal from "../components/wpsModel/index";
import BatchFileUploadModal from '../components/BatchFileUploadModal';
import BatchFileDownModel from '../components/BatchFileDownModel';

// 公共的组件
import SortModal from '../../../public/components/SortModal';
import BatchAddSub from '../../../public/components/BatchAddSub';
import RosterModal from '../../../public/components/RosterModal';
import BatchEditModal from '../../../public/components/BatchEdit';
import DragHeightCom from '../../../public/components/DragHeightCom';

// 公用方法
import deepCopy from '../../../public/functions/deep-copy';


// 功能函数
import processTemplate from './functions/processTemplateData';
import initButtonStatus from './functions/initButtonStatus';
import renderPage from './functions/renderPage';
import getMainTableData from './functions/getMainTableData';
import handleTableSelect from './functions/handleTableSelect';
import selectTree from './functions/selectTree';
import toggleModal from './functions/toggleModalVisible';
import getSelectedField from './functions/getSelectedField';
import processEditPageTemplate from './functions/processEditPageTemplage';
import deleteSubTableRows from './functions/deleteSubTableRows';
import addSubTableRow from './functions/addSubTableRow';
import pasteSubTableRow from './functions/pasteSubTableRow';
import insertSubTableRow from './functions/insertSubTableRow';
import deleteMainTableRow from './functions/deleteMainTableRow';
import batchAddSub from './functions/batchAddSub';
import exportPhoto from './functions/exportPhoto';
import showHisJobModal from './functions/showHisJobModal';
import showReportTo from './functions/showReportTo';
import createUser from './functions/createUser';
import cancelEdit from './functions/cancelEdit';
import selectAll from './functions/selectAll';
import importPhotos from './functions/importPhotos';
import importPhotosChange from './functions/importPhotoChange';
import printPage from './functions/print';
import fileManager from './functions/fileManager';
import printOutput from './functions/printOutput';
import exportPsn from './functions/exportPsn';
import setButtonStatus2 from './functions/setButtonStatus2';
import init from '../components/AddNewPage/functions/init'
// request函数
import getModifyData from '../request-functions/getModifyData';
import refreshRequest from '../components/AddNewPage/request/refresh';

import language from '../language';
import checkDbClick from './functions/checkDbClick';

import ins from '../instant';

import {handleHash, getAppPageConfig} from '../../../../hrpub/common/utils/utils';

import CardView from '../../../../hrpub/common/components/card-view';

const mock = mockFn();
const {PrintOutput} = high;

class EntryMng extends Component {
    constructor(props) {
        super(props);
        if (props.use) {
            props.use.form('bd_psndoc', 'hi_psnjob_h', 'batch_edit', 'batchAddSub', 'hi_psnorg_h', 'only_info_template');
            props.use.table('sort', 'hi_psnjob_history', 'hi_psnjob_history_down');
            props.use.editTable('ncc60071701list');
            props.use.cardTable(...props.cardTableList);
            props.use.search('ncc60071701query');
        }
        this.config = getAppPageConfig();

        this.state = {
            humanResourceOrganizationValue: {}, // 人力资源选择的值，大概率只用refpk属性
            page: 'main', // main  add-new 当前是哪个页面
            searchModalVisible: false, // 查询弹窗的显示隐藏
            onlyInfoModalVisible: false, // 唯一性信息验证弹窗的显示隐藏
            departmentTreeData: [], // 左侧部门树的数据
            currentSelectDepartment: '', // 当前选中的部门
            searchModalValue: {}, // 存储查询弹窗的输入值
            queryOid: '',
            include_child_depts: true, // 包含下级部门人员
            include_child_orgs: false, // 包含下级组织人员
            sortModalVisible: false,
            pageInfo: {
                pageSize: 10,
                pageIndex: 0,
                total: 0,
                totalPage: 1
            },
            hasSearched: false, // true表示已经进行过一次正常查询
            selectedRows: [], // 选中的行
            showTableCheckbox: true,
            switchToDocModalVisible: false,
            uniqueFields: '',
            addPageTemplate: {}, // 新增页面的模版填充数据数据, 从onlyinfomodal模块提交后返回更新
            batchEditModalVisible: false, // 批改弹窗显示/隐藏标志
            pageFrom: '', // 点击了哪个按钮转换的页面 add / modify
            batchAddSubVisible: false, // 批量添加子集弹窗的显示/隐藏标示
            copyData: {}, // 新增页面的表格，复制下来的数据, key值是表格的tableid
            show_all_info: false, // 显示所有信息
            show_on_job_psn: true, // 显示在职人员
            rosterModalVisible: false, // 联查花名册弹窗
            mainTableData: {}, // 主表的数据
            leftTreeType: 'orgRange', // 左树的类型，管理范围(orgRange)/人员类别(psnType)
            reptObjVisible: false, // 汇报对象弹窗
            reptColumns: [], // 回报对象用到的数据
            reptData: [], // 汇报对象 用到的数据
            createUserModalVisible: false, // 生成用户弹窗
            imageData: '', // 头像的base64码
            subTableEditable: true, // 为true代表子表可以编辑
            include_cancle_dept: false, // 是否包含已撤销部门
            showUploader: false, // 附件管理显示隐藏
            importModalVisible: false, // 导入
            printData: {
                filename: language['hi6007-000099'], /* 国际化处理： 员工信息*/
                funcode: '60071010',      //功能节点编码，即模板编码
                nodekey: '60071010list',
                oids: '',   // 单据pk  oids含有多个元素时为批量打印,
                outputType: 'output'
            }, // 输出的配置数据
            exportType: '', // 导出全部 all   导出 cur
            exportAllpks: [], //
            exportFilter: [], //
            fixTemplate: {}, // 最初的模版值
            allButtons: [], // 所有按钮
            clickRow: null, // 点击高亮的行数据
            showHistoryTable: false,
            disableUpload: false, // 禁止上传照片
            mainTableHeight: 350, // 主表格的高度
            subsetVisible: false, // 显示子集
            subsetCheckboxDisabled: true, // 显示子集的复选框是否可以用, 只有有数据的时候可以用
            pageHeight: 'auto', // 页面高度
            subsetCardChecked: false, // 显示子集的复选框的选中与否
            showSubsetChecked: false, // 收否选中显示子集
            photoRequired: false, // 照片是否必传
            isShowCardPag: false, //浏览态翻页
            subHeight: 0,
            isShowBottomDom: false,
            pk_wps_def:'', //wps要选择预览的人员
            wpsInitmodelVisible:false,//wps预览框显隐
            photoConf: {}
        };

        this.insRef = {
            subSetCard: null
        };

        this.updateState = this.updateState.bind(this);
        this.handleTableSelect = this.handleTableSelect.bind(this);
        this.getMainTableData = this.getMainTableData.bind(this);
        this.goBackToMainPage = this.goBackToMainPage.bind(this);
        this.getRef = this.getRef.bind(this);
        this.selectTree = this.selectTree.bind(this);
        this.toggleModal = this.toggleModal.bind(this);
        this.sortModalOnSure = this.sortModalOnSure.bind(this);
        this.copyRow = this.copyRow.bind(this);
        this.deleteRow = this.deleteRow.bind(this);
        this.pasteRow = this.pasteRow.bind(this);
        this.addRow = this.addRow.bind(this);
        this.toEditPage = this.toEditPage.bind(this);
        this.getModifyData = this.getModifyData.bind(this);
        this.processEditPageTemplate = this.processEditPageTemplate.bind(this);
        this.insertRow = this.insertRow.bind(this);
        this.deleteMainTableRow = this.deleteMainTableRow.bind(this);
        this.batchAddSub = this.batchAddSub.bind(this);
        this.toggleLeftTreeType = this.toggleLeftTreeType.bind(this);
        this.exportPhoto = this.exportPhoto.bind(this);
        this.showHisJobModal = this.showHisJobModal.bind(this);
        this.showReportTo = this.showReportTo.bind(this);
        this.createUser = this.createUser.bind(this);
        this.getMultiLanguage = this.getMultiLanguage.bind(this);
        this.cancelEdit = this.cancelEdit.bind(this);
        this.selectAll = this.selectAll.bind(this);
        this.importPhotos = this.importPhotos.bind(this);
        this.print = this.print.bind(this);
        this.fileManager = this.fileManager.bind(this);
        this.printOutput = this.printOutput.bind(this);
        this.addWebkitDirectory = this.addWebkitDirectory.bind(this);
        this.exportPsn = this.exportPsn.bind(this);
        this.setButtonStatus2 = this.setButtonStatus2.bind(this);
        this.checkDbClick = this.checkDbClick.bind(this);
        this.onLeftTreeCancelClick = this.onLeftTreeCancelClick.bind(this);
        this.setUpLoaderRef = this.setUpLoaderRef.bind(this);
        this.getPageHeight = this.getPageHeight.bind(this);
        this.previewCard = this.previewCard.bind(this);
        this.getCardViewRef = this.getCardViewRef.bind(this);
        this.onDragStop = this.onDragStop.bind(this);
    }

    // 设置上传照片的那个那个ref
    setUpLoaderRef(upload) {
        console.log(upload)
        this.upload = upload;
        this.upload.setState({
            disableUpload: this.state.disableUpload
        });
    }

    // 如果点击了
    onLeftTreeCancelClick() {
        this.props.editTable.setTableData('ncc60071701list', {rows: []}, false);
    }

    // 双击的时候检测是否可以预览
    checkDbClick(callback) {
        return checkDbClick.call(this, callback);
    }

    // 设置按钮状态
    setButtonStatus2(page) {
        setButtonStatus2.call(this, page);
    }

    // 输出
    printOutput() {
        printOutput.call(this);
    }

    // 附件管理
    fileManager() {
        fileManager.call(this);
    }

    // 打印
    print() {
        printPage.call(this);
    }

    // 导入照片
    importPhotos() {
        importPhotos.call(this);
    }

    // 生成用户
    createUser() {
        return createUser.call(this);
    }

    // 汇报对象
    showReportTo() {
        return showReportTo.call(this);
    }

    // 任职历史弹窗
    showHisJobModal() {
        return showHisJobModal.call(this);
    }

    // 导出照片
    exportPhoto() {
        return exportPhoto.call(this);
    }

    toggleLeftTreeType(type) {
        return () => {
            this.setState({
                leftTreeType: type
            });
            this.props.asyncTree.closeNodeByPkAsync('departmentTree');
        }
    }

    // 处理新增/修改页面初始化返回的模版数据
    processEditPageTemplate(res, cb) {
        processEditPageTemplate.call(this, res, cb);
    }

    // 获取修改页面数据
    async getModifyData(cb, pk_psnjob, refresh) {
        const {
            humanResourceOrganizationValue: {
                refpk
            },
            selectedRows,
            pageFrom
        } = this.state;
        let _pk_psnjob = pk_psnjob ? pk_psnjob : selectedRows[0].data.values['pk_psnjob'].value
        let postData = {
            func_type: '2',
            pk_org: refpk,
            pk_psnjob: _pk_psnjob
        };

        try {
            let res = null;

            if (refresh === 'refresh') {
                res = await refreshRequest(postData);
                if (res.success) {
                    this.setState({
                        addPageTemplate: {
                            ...this.state.addPageTemplate,
                            ...res.data
                        }
                    }, () => {
                        cb && cb.call(this);
                    });
                }
            } else {
                res = await getModifyData(postData, pageFrom);
                if (res.success) {
                    this.processEditPageTemplate(res, () => {
                        cb && cb.call(this);
                    });
                }
            }
            this.props.cardPagination.setCardPaginationId({id: _pk_psnjob, status: 1});
            // init.call(this)
        } catch (e) {
        }

    }

    // 跳转到新增/修改页面
    toEditPage(pageFrom, cb, pk_psnjob) {
        const {
            selectedRows
        } = this.state;
        pk_psnjob = pk_psnjob ? pk_psnjob : selectedRows[0].data.values['pk_psnjob'].value
        this.setState({
            isShowBottomDom: false
        })
        if (pageFrom === 'add') {
            this.setState({
                pageFrom: pageFrom,
                onlyInfoModalVisible: true,
                subTableEditable: true,
                disableUpload: false
            }, () => {
                cb && cb();
            });
        } else if (pageFrom === 'modify') {
            this.checkDbClick(() => {
                this.setState({
                    pageFrom: 'dbClick',
                    disableUpload: false,
                    isShowCardPag: false
                }, () => {
                    this.getModifyData(() => {
                        this.setState({
                            page: 'add-new',
                            subTableEditable: true,
                            disableUpload: false
                        }, () => {
                            cb && cb();
                        });
                        // 将按钮设置为修改页面的按钮
                        this.setButtonStatus2('addEditPage');
                    }, pk_psnjob);
                });
            })
        } else if (pageFrom === 'dbClick') { //双击进入
            this.setState({
                pageFrom: 'dbClick',
                disableUpload: true,
                isShowCardPag: true
            }, () => {
                this.getModifyData(() => {
                    this.setState({
                        page: 'add-new',
                        disableUpload: true
                    }, () => {
                        cb && cb();
                        this.cancelEdit();
                    });
                    this.setButtonStatus2('addEditPage');
                }, pk_psnjob);
            });
        }
    }

    // 选择左树
    selectTree(pk) {
        selectTree.call(this, pk)
    }

    // 主表选择
    handleTableSelect(props, moduleId, record, index) {
        handleTableSelect.call(this, props, moduleId, record, index);
    }

    // 通用更新state
    updateState(data, callback = () => {
    }) {
        this.setState(data, callback);
    }

    // 获取多语言
    getMultiLanguage() {
        return new Promise((resolve, reject) => {
            this.props.MultiInit.getMultiLang({
                moduleId: 'hi6007',
                domainName: 'hrhi',
                callback: (json, status, init) => {
                    Object.assign(language, json);
                    resolve();
                }
            });
        });
    }

    componentDidMount() {
        let {meta, button, createUIDom, templateData} = this.props;
        this.getMultiLanguage()
            .then(() => {
                const mock = mockFn();
                // createUIDom(this.config, (data = {}) => {
                let data = templateData;
                let photoConf = data['template']['bd_psndoc'].items.filter(item => item.attrcode === 'photo')[0];
                let photoRequired = photoConf.required;

                this.setState({
                    context: data.context,
                    queryOid: data.template.ncc60071701query.oid,
                    fixTemplate: data.template,
                    allButtons: data.button,
                    photoRequired: photoRequired,
                    photoConf: photoConf
                });

                Object.assign(data.template, mock.template);

                meta.setMeta(processTemplate.call(this, data.template || {}, data.button || []));
                button.setButtons(data.button || {});
                this.setButtonStatus2('init');
                // 这个功能是只允许导入文件夹
                // this.addWebkitDirectory();
                this.getPageHeight();
                // 此版本与05版本的要挂在search上，不是myState上，并且keySessionS为数组类型。
                let keySessionS = getMetaKey(this.config.appcode, this.config.pagecode);
                ins.ins.myState.search.keySessionS = [keySessionS];
                // });
            });
    }

    // 获取app高度
    getPageHeight() {
        if (window.getComputedStyle) {
            let height = window.getComputedStyle(document.getElementById('app')).height.replace('px', '');

            this.setState({
                pageHeight: height
            });
        }
    }

    // 获取主表数据
    getMainTableData(cb) {
        getMainTableData.call(this, cb);
    }

    // 返回主表
    goBackToMainPage() {
        this.setState({
            page: 'main',
            selectedRows: this.props.editTable.getCheckedRows('ncc600704list')
        });
        this.getMainTableData(() => {
            let insMyTable = ins.ins.myTable;

            ins.ins.myTable = {
                json: insMyTable.json,
                myEditTable: insMyTable.myEditTable,
                ncc60071702list: insMyTable['ncc600704list']
            };
            if (this.state.subsetVisible) {
                this.setState({isShowBottomDom: true})
                setTimeout(() => {
                    this.insRef.subSetCard.initSubSet();
                }, 1);
            }
        });
        this.setButtonStatus2('mainTableHasData');

        // 因为批量添加子集出现了一个无法查找原因的错误，
        // 错误表现为，当经过新增/修改页面修改template之后，
        // 批量添加子集弹窗第二步会报非法调用错误，
        // 所以为了将就这个错误，在返回主表之后，会将template重置为第一次的template
        // 猜测是因为动用了ajax的某些值，导致了非法调用, 待验证
        this.props.meta.setMeta(this.state.fixTemplate);
    }

    // 获取组件的实例对象
    getRef(refName) {
        return this[refName];
    }

    // 切换各种弹窗显示隐藏，type为弹窗的显示隐藏state的key值
    toggleModal(type, visible) {
        return toggleModal.call(this, type, visible);
    }

    // 排序弹窗点击确定的回调
    sortModalOnSure() {
        if (this.state.hasSearched) {
            this.getMainTableData();
        }
    }

    // 根据选中的行，拿出需要的字段
    getSelectedField(field, all) {
        return getSelectedField.call(this, field, all);
    }

    // 新增页面的表格复制
    copyRow(tableId, data) {
        this.setState({
            copyData: {
                ...this.state.copyData,
                [tableId]: deepCopy(data)
            }
        }, () => {
            toast({
                color: 'success',
                content: language['hi6007-000173']/* 国际化处理： 复制成功*/
            });
        });
    }

    // 新增页面删除表格行
    deleteRow(tableId, indexList) {
        return deleteSubTableRows.call(this, tableId, indexList);
    }

    // 新增页面粘贴
    pasteRow(tableId, index) {
        return pasteSubTableRow.call(this, tableId, index);
    }

    // 新增页面新增加一行
    addRow(tableId, index, values = {}, focus = false) {
        return addSubTableRow.call(this, tableId, index, values = {}, focus = false);
    }

    // 新增页面插入一行
    insertRow(tableId, index) {
        return insertSubTableRow.call(this, tableId, index);
    }

    // 主表删除方法
    deleteMainTableRow() {
        return deleteMainTableRow.call(this);
    }

    // 触发批量添加子集功能
    batchAddSub() {
        return batchAddSub.call(this);
    }

    // 取消编辑，进入预览态
    cancelEdit() {
        cancelEdit.call(this);
    }

    // 点击全选按钮
    selectAll(props, tableId, status, length) {
        selectAll.call(this, status);
    }

    // 给导入照片的uploader的input添加允许传入文件夹
    addWebkitDirectory() {
        let oInput = document.querySelector('.import-photo-wrapper').querySelector('input[type="file"]');

        oInput.webkitdirectory = true;
    }

    // 导出和导出全部的点击
    exportPsn(type) {
        exportPsn.call(this, type);
    }

    // 联查卡片
    previewCard() {
        let rows = this.props.editTable.getCheckedRows('ncc60071701list');
        console.log(rows)
        if(rows.length > 1 || rows.length == 0 ){
            toast({
                color: 'warning',
                content: language['hi6007-23030173'] || '请选择单一人员'/* 国际化处理： 复制成功*/
            });
            return
        }else{
            this.setState({
                pk_wps_def: rows[0].data.values['pk_psndoc'],
                wpsInitmodelVisible:true
            })
        }
        // this.cardViewRef.openCardViewModal(rows);
    }

    // 获取联查卡片实例
    getCardViewRef(ref) {
        this.cardViewRef = ref;
    }

    onDragStop(clientHei) {
        let pageHeight = window.getComputedStyle(document.getElementById('app')).height.replace('px', '');
        let hei = pageHeight - clientHei
        if (document.getElementsByClassName("dragHeightCom_top")) {
            document.getElementsByClassName("dragHeightCom_top")[0].style.height = hei+'px'
            this.setState({
                subHeight: clientHei
            })
        }
    }

    render() {

        const {
            searchModalVisible,
            onlyInfoModalVisible,
            queryOid,
            sortModalVisible,
            switchToDocModalVisible,
            importModalVisible,
            humanResourceOrganizationValue,
            currentSelectDepartment,
            uniqueFields,
            pk_psndocs,
            batchFileDownModelVisiable,
            batchFileDownModeltreeData,
            batchEditModalVisible,
            selectedRows,
            batchAddSubVisible,
            include_child_depts,
            include_child_orgs,
            include_child_psncl,
            show_all_info,
            rosterModalVisible,
            show_on_job_psn,
            reptObjVisible,
            reptColumns,
            reptData,
            createUserModalVisible,
            showUploader,
            printData,
            exportType,
            exportFilter,
            exportAllpks,
            clickRow,
            showHistoryTable,
            subsetVisible,
            pageHeight,
            subHeight,
            page,
            wpsInitmodelVisible,
            pk_wps_def
        } = this.state;

        const {
            table,
            cardTable,
            meta,
            editTable,
            form
        } = this.props;

        const rosterPks = this.getSelectedField('pk_psnjob', true);
        let dragHeightCom1 = document.getElementsByClassName('dragHeightCom')[0]
        let height = 'auto';

        if ((page === 'main' || page === 'adjust-sort')) {
            if (subsetVisible) {
                // height = '70%';
                height = '100%'
                if (dragHeightCom1) dragHeightCom1.style.height = '100%'
            } else {
                height = `${pageHeight}px`
            }
        } else {
            if (dragHeightCom1) dragHeightCom1.style.height = 'auto' // 否则详情页面的顶部不能固定
        }
        let topDom =
            <div
                className="nc-bill-tree-table entry-mng-page"
                style={{
                    height: height,
                    overflow: 'auto'
                }}
            >
                {renderPage.call(this)}
            </div>
        let bottomDom =
            <div>
                {page === 'main' && subsetVisible && <SubSetTable
                    {...this.props}
                    visible={subsetVisible}
                    ref={ref => this.insRef['subSetCard'] = ref}
                    orgVal={humanResourceOrganizationValue}
                    pageHeight={pageHeight}
                    subHeight={subHeight}
                    mainTableId="ncc60071701list"
                />}
            </div>
        return (
            <div>
                <DragHeightCom
                    topDom={topDom}
                    bottomDom={bottomDom}
                    isShowBottomDom={this.state.isShowBottomDom}
                    defBottomHei='25%'
                    onDragStop={this.onDragStop}
                />
                <SearchModal
                    {...this.props}
                    subsetVisible = {this.state.subsetVisible}
                    subsetCard = {this.insRef['subSetCard']}
                    updateState={this.updateState}
                    searchModalVisible={searchModalVisible}
                    getMainTableData={this.getMainTableData}
                />
                <OnlyInfoModal
                    {...this.props}
                    onlyInfoModalVisible={onlyInfoModalVisible}
                    updateState={this.updateState}
                    queryOid={queryOid}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    currentSelectDepartment={currentSelectDepartment}
                    uniqueFields={uniqueFields}
                    copyRow={this.copyRow}
                    deleteRow={this.deleteRow}
                    pasteRow={this.pasteRow}
                    addRow={this.addRow}
                    processEditPageTemplate={this.processEditPageTemplate}
                    setButtonStatus2={this.setButtonStatus2}
                />
                <SortModal
                    {...this.props}
                    visible={sortModalVisible}
                    onSure={this.sortModalOnSure}
                    onClose={this.toggleModal('sortModalVisible', false)}
                    templateId="sort"
                    func_type={2}
                />
                <SwitchToDocModal
                    {...this.props}
                    switchToDocModalVisible={switchToDocModalVisible}
                    updateState={this.updateState}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    getMainTableData={this.getMainTableData}
                />
                <BatchEditModal
                    {...this.props}
                    batchEditModalVisible={batchEditModalVisible}
                    updateState={this.updateState}
                    ref={ref => this.batchEdit = ref}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    selectedRows={selectedRows}
                    func_type={2}
                />
                <BatchAddSub
                    {...this.props}
                    meta={meta}
                    editTable={editTable}
                    form={form}
                    visible={batchAddSubVisible}
                    func_type={2}
                    param_str={this.getSelectedField('pk_psnjob').join(',')}
                    pk_org={humanResourceOrganizationValue.refpk}
                    onClose={() => {
                        this.setState({
                            batchAddSubVisible: false
                        });
                    }}
                />
                <RosterModal
                    {...this.props}
                    orgVal={humanResourceOrganizationValue}
                    queryOid={queryOid}
                    tree_node_id={currentSelectDepartment}
                    include_child_depts={include_child_depts}
                    include_child_orgs={include_child_orgs}
                    include_child_psncl={include_child_psncl}
                    show_all_info={show_all_info}
                    show_on_job_psn={show_on_job_psn}
                    visible={rosterModalVisible}
                    onClose={this.toggleModal('rosterModalVisible', false)}
                    rosterPks={rosterPks && rosterPks.join(',')}
                    func_type={2}
                />
                <JobHisModal {...this.props} showHistoryTable={showHistoryTable}/>
                <ReptObjModal
                    {...this.props}
                    visible={reptObjVisible}
                    columns={reptColumns}
                    data={reptData}
                    onClose={this.toggleModal('reptObjVisible', false)}
                />
                <CreateUserModal
                    {...this.props}
                    visible={createUserModalVisible}
                    onClose={this.toggleModal('createUserModalVisible', false)}
                    selectedRows={selectedRows}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                />
                <ImportModal
                    {...this.props}
                    visible={importModalVisible}
                    orgVal={humanResourceOrganizationValue}
                    onClose={this.toggleModal('importModalVisible', false)}
                    getMainTableData={this.getMainTableData}
                />
                {showUploader && <FileManager
                    table={editTable}
                    onClose={this.toggleModal('showUploader', false)}
                    clickRow={clickRow}
                />}
                <PrintOutput
                    ref={ref => this.printOutputRef = ref}
                    url={'/nccloud/hrhi/psndoc/PsndocTemplatePrintAction.do'}
                    data={printData}
                />
                <WpsModal
                    {...this.props}
                    updateState={this.updateState}
                    pk_org={humanResourceOrganizationValue}
                    wpsInitmodelVisible = {wpsInitmodelVisible}
                    pk_psndoc = {pk_wps_def.value}
                    username = {pk_wps_def.display}
                />
                 <ExportModal
                    {...this.props}
                    orgVal={humanResourceOrganizationValue}
                    appcode={this.config.appcode}
                    show_on_job_psn={show_on_job_psn}
                    exportType={exportType}
                    exportFilter={exportFilter}
                    exportAllpks={exportAllpks}
                />
                <BatchFileUploadModal
                    {...this.props}
                />
                <BatchFileDownModel
                    {...this.props}
                    updateState={this.updateState}
                    pk_psndocs={pk_psndocs}
                    batchFileDownModelVisiable={batchFileDownModelVisiable}
                    batchFileDownModeltreeData={batchFileDownModeltreeData}
                />
                <CardView
                    {...this.props}
                    onRef={this.getCardViewRef}
                />
            </div>
        );
    }
}

export default EntryMng;
